import {Fetch} from "./request";

export function loginApi(username: string, password: string) {
    return Fetch.post('/user/login', {
        username,
        password
    })
}

export function registerApi(username: string, password: string) {
    return Fetch.post('/user/register', {
        username,
        password
    })
}

export function listEmployeeConditionApi(page: number, size: number, sex: string = null, job: string = null, exited: boolean = null) {
    let params = {
        page,
        size
    }
    if (sex) {
        params['sex'] = sex;
    }
    if (job) {
        params['job'] = job;
    }
    if (exited) {
        params['exited'] = exited;
    }
    return Fetch.get('/employee/list/condition', params)
}

export function saveCuisineApi(cuisine: any) {
    return Fetch.post('/cuisine/save', cuisine)
}

export function listCuisinesApi() {
    return Fetch.get('/cuisine/list')
}

export function listVIPApi() {
    return Fetch.get('/member/list')
}

export function listOrderApi() {
    return Fetch.get('/purchase/list')
}

export function listMarketingApi() {
    return Fetch.get('/activity/list');
}

export function deleteVIPApi(id) {
    return Fetch.delete(`/member/delete/${id}`)
}

export function deleteCuisineApi(id: any) {
    return Fetch.delete(`/cuisine/delete/${id}`)
}

export function listCuisinesProApi() {
    return Fetch.get('/cuisine/listPro')
}

export function saveEmployeeApi(employee: any) {
    return Fetch.post('/employee/save', employee)
}

export function deleteMarketingApi(id:any) {
    return Fetch.delete(`/activity/delete/${id}`)
}

export function deleteOrderApi(id:any) {
    return Fetch.delete(`/purchase/delete/${id}`)
}